﻿

namespace Mulala.Cavan.Domain.MainBoundedContext.ConsignModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using FluentValidation;
    using Mulala.Cavan.Core.Helper;
    using Mulala.Cavan.Domain.MainBoundedContext.Resources;

    public class ConsignValidator : AbstractValidator<Consign>
    {
        public ConsignValidator()
        {
            RuleFor(c => c.Name).NotEmpty().Length(2, 100).WithMessage(Messages.Validate_ConsignNameIsInvalid);
            RuleFor(c => c.Area).NotNull().WithMessage(Messages.Validate_ConsignAreaIsInvalid);
            RuleFor(c => c.Address).NotEmpty().Length(2, 100).WithMessage(Messages.Validate_ConsignAddressIsInvalid);
            RuleFor(c => c.Type).NotNull();
            RuleFor(c => c.Range).NotNull();
            RuleFor(c => c.Contact).NotEmpty().Length(2, 10).WithMessage(Messages.Validate_ConsignContactIsInvalid);
            RuleFor(c => c.Telephone).NotEmpty().Matches(StringHelper.TELEPHONEREGULAR).WithMessage(Messages.Validate_TelephoneIsInvalid);
            RuleFor(c => c.Remark).Length(2, 2000).WithMessage(Messages.Validate_ConsignRemarkIsInvalid);
        }
    }
}
